<template>
  <div>
    <!-- <el-tabs v-model="activeName" @tab-click="handleTabClick">
      <template v-for="item in optList">
        <el-tab-pane :key="item.code" :name="item.code" :label="item.name" />
      </template>
    </el-tabs> -->
    <train-list v-if="activeName === 'TrainManage'" />
    <!-- <league-list v-if="activeName === 'League'" /> -->
  </div>
</template>
<script>
import trainList from './trainList/index';
// import leagueList from './league/trainList/index';
import { mapState } from 'vuex';
export default {
  components: {
    trainList
    // leagueList
  },
  data() {
    return {
      activeName: '',
      optList: [
        {
          code: 'TrainManage',
          name: '培训',
          component: trainList
        }
        // {
        //   code: 'League',
        //   name: '联赛',
        //   component: leagueList
        // }
      ]
    };
  },
  computed: {
    ...mapState({
      tenantId: state => state.user.tenantId
    })
  },
  created() {
    this.activeName = this.$route.query.trainType || 'TrainManage';
  },
  methods: {
    handleTabClick(tabItem) {
      const _tenantId = this.tenantId ? this.tenantId : '';
      this.$router.push({
        path: '/t__' + _tenantId + '/train/manage',
        query: { trainType: tabItem.name }
      });
    }
  }
};
</script>
